Skip to content

Compat/dataaccess - #779

Merged
jaen15marcos merged 4 commits into
DataIntellectTech:masterfrom
jaen15marcos:compat/dataaccess
Dec 4, 2026
Merged

jaen15marcos merged 4 commits into
DataIntellectTech:masterfrom
jaen15marcos:compat/dataaccess

Conversation

@jaen15marcos

Copy link
Copy Markdown
Contributor
  • Postback: since 720-fixes-for-kdb-x #721 every request with a postback was rejected with an empty error, and even before that a valid postback failed with 'rank. Through the gateway, an async .dataaccess.getdata with a postback now delivers the result to it, and a sync one gets the existing “Postback key only allowed for async requests”.
  • With discovery off: under a connection limit, TorQ turns discovery off (#725 dev #727), and a process that made no other connection never initialised the data-access API. With discovery off, and only then, the API is also initialised at the end of start-up; a failure is only logged.
  • Portable checks: checkeachparam, extractoptimisationkey and readtableproperties avoid three q forms that not every q engine reads the same way. Their results on kdb+ are unchanged.
  • Tests: dataaccess/gwquerytest’s mock RDB gets the .rdb.getpartition the gateway calls, and dataaccess/queryorder loads its own HDB.

Testing: master 618 of 848, master with this PR 711 of 848.

- .checkinputs.checkpostback rejected every postback. Its two checks look
  for a sync key, which is not a valid parameter (checkparamnames rejects
  any request that has one), and signal
  .schema.errors[`asyncpostback;`errormessage], which errormessages.csv
  does not define, so the error message was empty. Before DataIntellectTech#721 the two
  lines were missing their semicolons and never ran; once they ran, no
  postback got through. The check now asks the gateway: .gw.call says
  whether the caller's request is synchronous, and a postback on a sync
  request is refused with the existing checkpostback message ("Postback
  key only allowed for async requests"). On a process that is not a
  gateway, .gw.call does not exist and the check passes.

- The gateway posts back (postback;query;result), and the client calls
  postback[query;result], while the data-access checks only accept a
  postback that takes one argument (the docs show {0N!x}). So even before
  DataIntellectTech#721 a valid postback failed with 'rank on the client. The gateway now
  hands asyncexecjpt {[f;q;r] f r}[postback], which takes the query and
  the result and gives the user's function the result.

Through the gateway, an async getdata with the postback {`pbres set count
x} now sets pbres to the row count on the client, and a sync getdata with
a postback is refused with "Postback key only allowed for async requests".
…te three of its checks portably

- .dataaccess.init runs on every new connection (.servers.connectcustom),
  and a process normally makes one at start-up, to discovery. Under a
  connection limit, such as KDB-X's free licence (16 connections), TorQ
  turns discovery off (DataIntellectTech#727), so a process with no other connection to
  make never got the data-access API, and most data-access tests failed
  there. With discovery off, init now also runs once at the end of
  start-up, and a failure there is only logged, as on a new connection.
  With discovery on nothing changes.
- .checkinputs.checkeachparam iterates over the row indices of the
  parameter table rather than over the table itself, which not every q
  implementation can iterate. The result is the same.
- .eqp.extractoptimisationkey sets optimisation from the request, or 1b,
  instead of filling one dictionary into another with ^.
- readtableproperties writes its "all or blank" proctype list as ``all
  rather than `all` - the same two symbols - as some q implementations'
  functional selects return nothing when a literal symbol list ends with
  the null symbol.
- dataaccess/gwquerytest: since DataIntellectTech#639 the RDB advertises its partition
  through .rdb.getpartition, which processes/rdb.q defines. The test's
  mock RDB does not load rdb.q and only set .rdb.rdbpartition, so
  .proc.getattributes failed, the gateway held no attributes for it, and
  every query routed to the RDB got "no info found for that table name
  and time range". The mock RDB now defines .rdb.getpartition as well.
- dataaccess/queryorder loaded its HDB with \l hdb, which is
  $TORQHOME/hdb, not the test's own HDB with the attribute helpers.
checkeachparam iterates over the config table again, and
readtableproperties writes the symbol list as enlist`all` again. Both
were rewritten for q engines that read them differently from kdb+. The
current builds of those engines read master's forms as kdb+ does, so the
rewrites are no longer needed.

getdata renames its result's columns only where the query asks for a
rename. Without one it called xcol with an empty dictionary, which kdb+
accepts and which gives 'type on some q engines, so every getdata call
failed there.
@jaen15marcos
jaen15marcos merged commit f623c53 into DataIntellectTech:master Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants